package com.zhou.piledriver.common;

import jakarta.servlet.http.HttpServletResponse;

import java.io.Serial;
import java.io.Serializable;

public class R implements Serializable {
    @Serial
    private static final long serialVersionUID = -7646978477499230456L;
    private final static String SUCCESS = "success";
    private final static String FAIL = "fail";

    public static <T> ResponseResult<T> success() {
        return success(null);
    }
    public static <T> ResponseResult<T> success(T data) {
        return new ResponseResult<>(HttpServletResponse.SC_OK,SUCCESS,data);
    }

    public static <T> ResponseResult<T> fail(T msg) {
        return new ResponseResult<>(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,FAIL,msg);
    }
}
